# slock-ng - simple screen locker (fork of slock)
# slock authors:
# © 2006-2007 Anselm R. Garbe, Sander van Dijk
#
# 2010 Andrienko E.A.

include config.mk

SRC = slock-ng.c
OBJ = ${SRC:.c=.o}

all: options slock-ng

options:
	@echo slock-ng build options:
	@echo "CFLAGS   = ${CFLAGS}"
	@echo "LDFLAGS  = ${LDFLAGS}"
	@echo "CC       = ${CC}"

.c.o:
	@echo CC $<
	@${CC} -c ${CFLAGS} $<

${OBJ}: config.mk

slock-ng: ${OBJ}
	@echo CC -o $@
	@${CC} -o $@ ${OBJ} ${LDFLAGS}

clean:
	@echo cleaning
	@rm -f slock-ng ${OBJ} slock-ng-${VERSION}.tar.gz

dist: clean
	@echo creating dist tarball
	@mkdir -p slock-ng-${VERSION}
	@cp -R LICENSE Makefile README config.mk ${SRC} slock-ng-${VERSION}
	@tar -cf slock-ng-${VERSION}.tar slock-ng-${VERSION}
	@gzip slock-ng-${VERSION}.tar
	@rm -rf slock-ng-${VERSION}

install: all
	@echo installing executable file to ${DESTDIR}${PREFIX}/bin
	@mkdir -p ${DESTDIR}${PREFIX}/bin
	@cp -f slock-ng ${DESTDIR}${PREFIX}/bin
	@chmod 755 ${DESTDIR}${PREFIX}/bin/slock-ng
	@chmod u+s ${DESTDIR}${PREFIX}/bin/slock-ng

uninstall:
	@echo removing executable file from ${DESTDIR}${PREFIX}/bin
	@rm -f ${DESTDIR}${PREFIX}/bin/slock-ng

.PHONY: all options clean dist install uninstall
